package com.example.demokafka;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class TestApi {

    @Autowired
    private KafkaProducer kafkaProducer;

    @GetMapping("/sendMsg")
    public String sendMsg() {
        TestObj testObj = new TestObj();
        testObj.setGsert(23L);
        testObj.setWedfa("ert234twt");
        kafkaProducer.send(testObj);
        return "ok";
    }
}
